from page.base_page import BasePage
from appium.webdriver.common.appiumby import AppiumBy as By
class HomePage(BasePage):
    """首页页面"""
    #定位器
    classify_locator=(By.ANDROID_UIAUTOMATOR,'new UiSelector().text("收藏")')
    own_locator=(By.ANDROID_UIAUTOMATOR,'new UiSelector().resourceId("com.xiachufang:id/tab_widget_content_self")')
    plus_locator=(By.ANDROID_UIAUTOMATOR,'new UiSelector().resourceId("com.xiachufang:id/iv_home_upload")')
    search_locator=(By.ID,"com.xiachufang:id/search_edit_text")
    browsing_history_locator=(By.ANDROID_UIAUTOMATOR,'new UiSelector().text("浏览历史")')
    kljc_locator=(By.ID,"com.xiachufang:id/common_first_text")
    information_locator=(By.ID,"com.xiachufang:id/man_profile_user_info_container")
    follow_locator=(By.XPATH,'//android.widget.LinearLayout[@resource-id="com.xiachufang:id/user_property_layout"]/android.widget.FrameLayout[1]/android.widget.LinearLayout')
    def click_classify(self):
        """点击收藏"""
        bp=BasePage(self.driver)
        bp.show_waiting(self.driver,self.classify_locator).click()
    def click_own(self):
        """点击我"""
        bp=BasePage(self.driver)
        bp.show_waiting(self.driver, self.own_locator).click()
    def click_plus(self):
        """点击 + """
        bp=BasePage(self.driver)
        bp.show_waiting(self.driver, self.plus_locator).click()
    def clicak_search(self):
        """点击搜索"""
        bp=BasePage(self.driver)
        bp.show_waiting(self.driver, self.search_locator).click()
    def click_browsing_history(self):
        """点击历史浏览"""
        bp = BasePage(self.driver)
        bp.show_waiting(self.driver, self.browsing_history_locator).click()
    def click_kljc(self):
        """点击历史浏览"""
        bp = BasePage(self.driver)
        bp.show_waiting(self.driver, self.kljc_locator).click()
    def click_information(self):
        """点击信息"""
        bp = BasePage(self.driver)
        bp.show_waiting(self.driver, self.information_locator).click()
    def owm_follow(self):
        """点击关注"""
        bp = BasePage(self.driver)
        bp.show_waiting(self.driver, self.follow_locator).click()
